import axios from 'axios'
import Npogress from 'nprogress'
import 'nprogress/nprogress.css'

axios.defaults.baseURL = import.meta.VITE_APP_ENV


axios.interceptors.request.use((config)=>{
    config.headers.Authorization = localStorage.getItem('token') ? localStorage.getItem('token') : ''
     //开启进度条
      Npogress.start()
    return config
})

axios.interceptors.response.use((data) => {
    //关闭进度条加载
     Npogress.done()
    return data.data
},(error)=>{

})

export default axios